package com.atguigu.lease.app.mapper;

import com.atguigu.lease.model.bean.ApartmentFeeValue;
import com.atguigu.lease.model.vo.FeeValueVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* @author 1
* @description 针对表【apartment_fee_value(公寓&杂费关联表)】的数据库操作Mapper
* @createDate 2025-06-20 14:04:43
* @Entity com.atguigu.lease.model.bean.ApartmentFeeValue
*/
public interface ApartmentFeeValueMapper extends BaseMapper<ApartmentFeeValue> {
//    @Insert()
//    @Update()
//    @Delete()
    @Select("""
        select t2.* , t3.`name` fee_key_name
        from apartment_fee_value t1
        join fee_value t2
        on t2.is_deleted =0 and t2.id = t1.fee_value_id
        join fee_key t3
        on t3.is_deleted = 0 and t3.id = t2.fee_key_id
        where t1.is_deleted =0 and t1.apartment_id = #{apartmentId}
        """)
    List<FeeValueVo> selectFeeValueVoList(Long apartmentId);
}




